<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../Templates/InnerSystemTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:define name="head-title">
        <title>View Employee | Merlion's ERP System</title>
    </ui:define>
    
    <ui:define name="content">
        <h:form>
            <p:dataTable var="employee" value="#{viewEmployeeManagerBean.employees}" 
                         dynamic="true" paginator="true" rows="5" emptyMessage="No employee found in database." selection="#{viewEmployeeManagerBean.selectedEmployee}"> 
            
                    <p:column selectionMode="single" />
                    
                    <p:column sortBy="#{employee.employeeId}" filterBy="#{employee.employeeId}"> 
                        <f:facet name="header"> 
                            <h:outputText value="ID" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeId}" /> 
                    </p:column>
                    
                    <p:column sortBy="#{employee.userName}" filterBy="#{employee.userName}"> 
                        <f:facet name="header"> 
                            <h:outputText value="UserName" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.userName}" /> 
                    </p:column>
                    
                    <p:column sortBy="#{employee.password}" filterBy="#{employee.password}"> 
                        <f:facet name="header"> 
                            <h:outputText value="password" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.password}" /> 
                    </p:column> 
 
                    <p:column sortBy="#{employee.employeeName}" filterBy="#{employee.employeeName}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Name" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeName}" /> 
                    </p:column> 
                   
                    <p:column sortBy="#{employee.employeeNRIC}" filterBy="#{employee.employeeNRIC}"> 
                        <f:facet name="header"> 
                            <h:outputText value="NRIC" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeNRIC}" /> 
                    </p:column>
            
                    <p:column sortBy="#{employee.employeeEmail}" filterBy="#{employee.employeeEmail}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Email" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeEmail}" /> 
                    </p:column>
            
                    <p:column sortBy="#{employee.employeeAddress}" filterBy="#{employee.employeeAddress}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Address" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeAddress}" /> 
                    </p:column>
            
                    <p:column sortBy="#{employee.employeeContactNumber}" filterBy="#{employee.employeeContactNumber}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Contact Number" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.employeeContactNumber}" /> 
                    </p:column>
                    
                    <p:column sortBy="#{employee.attempt}" filterBy="#{employee.attempt}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Attempt" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.attempt}" /> 
                    </p:column>
                    
                    <p:column sortBy="#{employee.activatedStatus}" filterBy="#{employee.activatedStatus}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Activated Status" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.activatedStatus}" /> 
                    </p:column>
                    
                    <p:column sortBy="#{employee.position}" filterBy="#{employee.position}"> 
                        <f:facet name="header"> 
                            <h:outputText value="Position" /> 
                        </f:facet> 
                        <h:outputText value="#{employee.position.description}" /> 
                    </p:column>
                    
                    <f:facet name="footer">                          
                        <p:commandButton value="Edit" actionListener="#{viewEmployeeManagerBean.editEmployee}"/>                             
                    </f:facet>
        </p:dataTable>
            <p:confirmDialog message="Are you sure to delete the sale lead?"  
        showEffect="clip" hideEffect="fold" 
        header="Initiating delete process" severity="alert" widgetVar="saleLeadDeleteDialog">  

                <p:commandButton value="Yes" update="messages" oncomplete= "saleLeadDeleteDialog.hide()"  
                            actionListener="#{saleLeadDataTableBean.deleteSaleLead}" />  
                <p:commandButton value="No" onclick="saleLeadDeleteDialog.hide()" type="button" />   

            </p:confirmDialog>  
                    
        </h:form>
    </ui:define>

</ui:composition>
